package com.lwc.cfdns.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lwc.cfdns.pojo.BaseEntity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.lwc.cfdns.pojo.dto.ValidGroup;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * 部门表
 *
 * @TableName cfdns_system_dept
 */
@TableName(value = "cfdns_system_dept")
@Data
public class SystemDept extends BaseEntity implements Serializable {
    /**
     * 部门id
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 父部门id
     */
    @NotNull(message = "父部门id不能为空", groups = {ValidGroup.Create.class, ValidGroup.Update.class})
    private Long pId;

    /**
     * 祖级列表
     */
    private String ancestors;

    /**
     * 部门名称
     */
    @NotBlank(message = "部门名称不能为空", groups = {ValidGroup.Create.class, ValidGroup.Update.class})
    private String name;

    /**
     * 显示顺序
     */
    private Integer sort;

    /**
     * 负责人
     */
    private String leader;

    /**
     * 联系电话
     */
    private String phone;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 部门状态（0正常 1停用）
     */
    private String status;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    // 子部门
    @TableField(exist = false)
    private List<SystemDept> children = new ArrayList<>();
}